#! /bin/bash

# This launches an installation of the current Live system to the Eee

#You can actually feed liveinst a kickstart by adding a $1 to the end of
#the line in liveinst where it invokes anaconda... then you can do
#liveinst --kickstart=somefile.cfg and it passes the --kickstart= part to
#anaconda.. 

#If have not tried to feed it packages this way, but partitioning,
#network, password, %post, etc work fine...

setup=/root/eee-setup

. /etc/init.d/functions

# This actually gets checked in the liveinst script anyway

# Are we running this from a live image?  If not, then WTF!
#if ! strstr "`cat /proc/cmdline`" liveimg || [ "$1" != "start" ] || [ -e /.liveimg-configured ] ; then
# echo "Apparently this is not a live image - please don't try to install on top of it!"
# exit 0
#fi

# Need to start NetworkManager to get anaconda working...
/etc/init.d/NetworkManager restart

# The clever bit here is that /usr/bin/liveinst gets the root password (if needed)
# before executing the /usr/sbin/liveinst script
/usr/bin/liveinst "--kickstart=file:${setup}/live-install/eee-live-install.ks"
# Wowza!
